package com.niiwoo.civet.trade.dto.response.statisticsinfo;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

/**
 * @Description: 借款服务开放城市
 * @Author:huangmin
 */
@Setter
@Getter
public class FastBorrowAccreditCityResponseDTO implements Serializable,Comparable {

    private static final long serialVersionUID = -8406997934965438007L;
    //开放城市
    private String provinceName;

    //热门城市
    private List<AccreditCity> citys = new ArrayList<>();

    @Override
    public int compareTo(Object o) {
        FastBorrowAccreditCityResponseDTO fastBorrowAccreditCityResponseVO = (FastBorrowAccreditCityResponseDTO) o;
        Comparator cmp = Collator.getInstance(java.util.Locale.CHINA);
        return cmp.compare(this.provinceName, fastBorrowAccreditCityResponseVO.getProvinceName());
    }

    @Setter
    @Getter
    public static class AccreditCity implements Serializable,Comparable {

        private static final long serialVersionUID = 6681318809639113951L;
        //城市
        private String city;

        @Override
        public int compareTo(Object o) {
            AccreditCity accreditCity = (AccreditCity) o;
            Comparator cmp = Collator.getInstance(java.util.Locale.CHINA);
            return cmp.compare(this.city, accreditCity.getCity());
        }

    }

}
